from app import db

class HealthMetrics(db.Model):
    __tablename__ = 'health_metrics'

    user_id = db.Column(db.String(255), db.ForeignKey('user_info.user_id'), primary_key=True)
    heart_rate_avg = db.Column(db.Integer)
    heart_rate_max = db.Column(db.Integer)
    heart_rate_rest = db.Column(db.Integer)
    diastolic = db.Column(db.Integer)
    systolic = db.Column(db.Integer)
    visceral_fat_area = db.Column(db.Integer)
    muscle_mass = db.Column(db.Integer)
    uric_acid = db.Column(db.Integer)
    blood_fat = db.Column(db.Float)
    blood_sugar = db.Column(db.Float)

    user = db.relationship('UserInfo', backref='health_metrics', uselist=False)

    def __repr__(self):
        return f'<HealthMetrics {self.user_id}>'
